package com.kws.merchant.service.impl;


import com.kws.merchant.domain.OrderPayLog;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.kws.merchant.mapper.OrderPayLogMapper;
import com.kws.merchant.service.OrderPayLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

/**
 * 订单支付记录(OrderPayLog)表服务实现类
 *
 * @author yxy
 * @since 2024-11-20 14:32:16
 */
@Service("orderPayLogService")
public class OrderPayLogServiceImpl extends ServiceImpl<OrderPayLogMapper, OrderPayLog> implements OrderPayLogService {

    @Resource
    private OrderPayLogMapper orderPayLogMapper;


    /**
     * 分页查询列表
     */
    @Override
    public Page<OrderPayLog> pageList(OrderPayLog orderPayLog) {
        Page<OrderPayLog> page = new Page<>(0, 10);
        LambdaQueryWrapper<OrderPayLog> queryWrapper = Wrappers.lambdaQuery();

        return this.page(page, queryWrapper);
    }

    /**
     * 商家统计支付-退款金额
     * @param userId
     * @param payType
     * @return
     */
    @Override
    public Double payCountByTime(Long userId, int payType,String time) {
        return orderPayLogMapper.payCountByTime(userId,payType,time);
    }

    /**
     * 总在途订单金额
     * @param userId
     * @param payType
     * @return
     */
    @Override
    public Double payCount(Long userId, int payType) {
        return orderPayLogMapper.payCount(userId,payType);
    }

    /**
     * 总用户退款金额
     * @param userId
     * @param payType
     * @return
     */
    @Override
    public Double countPayCount(Long userId, int payType) {
        return orderPayLogMapper.countPayCount(userId,payType);
    }

    /**
     * 总在途订单数
     * @param userId
     * @param payType
     * @return
     */
    @Override
    public Double countOrderCount(Long userId, int payType) {
        return orderPayLogMapper.countOrderCount(userId,payType);
    }

    /**
     * 昨日订单数量统计
     * @param userId
     * @param payType
     * @param time
     * @return
     */
    @Override
    public Double yesterdayOrderCount(Long userId, int payType, String time) {
        return orderPayLogMapper.yesterdayOrderCount(userId,payType,time);
    }


}
